/*
 * Copyright 2008 Wink Saville
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 3
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import com.saville.debug.Log;
import com.saville.msgcomp.*;
import com.saville.mc.*;
import com.saville.testclient.TestClient;

public class McTest extends ActiveMc {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        new McTest("McTest");
    }

    public McTest(String name) {
        super(name);

        int srvrDstId = lookup("TestHmcServer");
        if (srvrDstId >= 0) {
            Msg msg;
            Log.print("McTest: send a msg to TestHmcServer");
            msg = getMsg();
            msg.dstId = srvrDstId;
            msg.dstSubId = 0;
            msg.guid = 0;
            msg.cmd = 0 | McConst.NOISY;
            sendMsg(msg);

            Log.print("McTest: Start McTestClient");
            new TestClient("McTestClient");
            int clientDstId = lookup("McTestClient");
            if (clientDstId >= 0) {
                msg = getMsg();
                msg.dstId = clientDstId;
                msg.dstSubId = 0;
                msg.guid = 0;
                msg.cmd = 0;
                msg.arg1 = 5; // Count
                msg.arg2 = srvrDstId; // ServerDstId
                msg.arg3 = 0 | McConst.NOISY; // ServerCmd
                sendMsg(msg);
            } else {
                Log.print("McTest: could not find 'McTestClient'");
            }
        } else {
            Log.print("McTest: could not find 'TestHmcServer'");
        }

        Log.print("McTest: X");
    }

    public void processMsg(Msg msg) {
    }
}
